$(function(){	
	//快递列表
	expressList();
	
	//选择快递方式
	$(".addr_same .confirm_info .d p .expressList").change(function(){
		//alert($(this).children('option:selected').val()); 
		//$(".addr_same .confirm_info .d p .r i").text($(this).children('option:selected').attr('fee'));
		var $old_express_fee = $(this).next().find("i").text();
		var $new_express_fee = $(this).children('option:selected').attr('fee');
		$(this).next().find("i").text($new_express_fee);
		$("#expressId").val($(this).children('option:selected').val());
		//计算每个店铺的商品总金额		
		calculatePrice();
     });
});



//快递列表
function expressList(){
	var url = rootPath + "/order/expressList";
	var expressList = CommnUtil.ajax(url,{},"html");
	console.log(expressList);
	var list = JSON.parse(expressList).data;
	//	alert($("#expressList"));
		$(".addr_same .confirm_info .d p .expressList").each(function(){
			for(var i =0; i< list.length; i++){
				var express = list[i];
				if(i== 0){
					$(".addr_same .confirm_info .d p .r i").text(express.fee.toFixed(2));
					calculatePrice();
				}
			   $(this).append("<option value='"+express.id+"' fee='"+ express.fee.toFixed(2) +"'>"+express.name+"</option>");

			}
		});
}